package com.example.mapp;

import com.example.entity.training.TrainingPlanDetail;
import com.example.mapp.buildSql.TrainingPlanDetailMappSql;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface TrainingPlanDetailMapp {
    @Insert(" insert into training_plan_detail (check_in_table, create_date, create_user, end_date, lead_unit, plan_id, plan_status, start_date, summary_statement, training_photo," +
            " unit_manage_user, party_id,party_name, party_type, plan_name) values (#{checkInTable},#{createDate},#{createUser},#{endDate},#{leadUnit},#{planId},#{planStatus},#{startDate},#{summaryStatement},#{trainingPhoto}," +
            " #{unitManageUser},#{partyId},#{partyName},#{partyType},#{planName})")
    int insert(TrainingPlanDetail trainingPlanDetail) throws Exception;

    @Delete("delete from training_plan_detail where id=#{id}")
    int delete(String id) throws  Exception;

    @Update("update training_plan_detail set end_date=#{endDate},start_date = #{startDate},plan_status = #{planStatus},adjust_date = #{adjustDate}, adjust_reason = #{adjustReason} where id = #{id}")
    int update(TrainingPlanDetail trainingPlanDetail) throws Exception;


    @SelectProvider(type = TrainingPlanDetailMappSql.class, method = "queryTrainingPlanDetail")
   List<TrainingPlanDetail> query(TrainingPlanDetail trainingPlanDetail) throws Exception;

    @Update("update training_plan_detail set plan_status = #{planStatus} where id = #{id}")
    int updateStatus(Map map) throws Exception;

    @Update("update training_plan_detail set training_photo = #{trainingPhoto} where id = #{id}")
    int uploadTrainingPhoto(TrainingPlanDetail trainingPlanDetail) throws Exception;

    @Update("update training_plan_detail set check_in_table = #{checkInTable} where id = #{id}")
    int uploadCheckInTable(TrainingPlanDetail trainingPlanDetail) throws Exception;

    @Update("update training_plan_detail set summary_statement = #{summaryStatement} where id = #{id}")
    int uploadSummaryStatement(TrainingPlanDetail trainingPlanDetail) throws Exception;

}
